package types

// Reference: https://www.ietf.org/rfc/rfc4120.txt
// Section: 5.2.8

import (
	
)

// NewKrbFlags returns an ASN1 BitString struct of the right size for KrbFlags.
func () asn1.BitString {
	 := asn1.BitString{}
	.Bytes = make([]byte, 4)
	.BitLength = len(.Bytes) * 8
	return 
}

// SetFlags sets the flags of an ASN1 BitString.
func ( *asn1.BitString,  []int) {
	for ,  := range  {
		SetFlag(, )
	}
}

// SetFlag sets a flag in an ASN1 BitString.
func ( *asn1.BitString,  int) {
	for  := len(.Bytes);  < 4; ++ {
		(*).Bytes = append((*).Bytes, byte(0))
		(*).BitLength = len((*).Bytes) * 8
	}
	//Which byte?
	 :=  / 8
	//Which bit in byte
	 := uint(7 - ( - 8*))
	(*).Bytes[] = (*).Bytes[] | (1 << )
}

// UnsetFlags unsets flags in an ASN1 BitString.
func ( *asn1.BitString,  []int) {
	for ,  := range  {
		UnsetFlag(, )
	}
}

// UnsetFlag unsets a flag in an ASN1 BitString.
func ( *asn1.BitString,  int) {
	for  := len(.Bytes);  < 4; ++ {
		(*).Bytes = append((*).Bytes, byte(0))
		(*).BitLength = len((*).Bytes) * 8
	}
	//Which byte?
	 :=  / 8
	//Which bit in byte
	 := uint(7 - ( - 8*))
	(*).Bytes[] = (*).Bytes[] &^ (1 << )
}

// IsFlagSet tests if a flag is set in the ASN1 BitString.
func ( *asn1.BitString,  int) bool {
	//Which byte?
	 :=  / 8
	//Which bit in byte
	 := uint(7 - ( - 8*))
	if (*).Bytes[]&(1<<) != 0 {
		return true
	}
	return false
}